﻿
Public MustInherit Class Procesador : Inherits SubprogramasComunes
    Protected Nombre As String
    Protected Ejecutable As String

    Protected Shared Function EjecutableExiste(ByVal ruta As String) As Boolean
        If Not My.Computer.FileSystem.FileExists(ruta) Then
            Throw New Exception("No se encuentra " & ruta)
        End If
        Return True
    End Function

    Protected Shared Function GeneraParametros(ByVal plantilla As String, ByVal inData As String, ByVal outData As String, ByVal ejecutable As String) As String

        Dim partes() As String = Split(plantilla, "%")
        Dim parametroGenerado As String = ""

        For Each parte As String In partes
            If parte = "in" Then
                parametroGenerado += """" & inData & """"
            ElseIf parte = "out" Then
                parametroGenerado += """" & outData & """"
            ElseIf parte = "exec" Then
                parametroGenerado += """" & ejecutable & """"
            Else
                parametroGenerado += parte
            End If
        Next

        Return parametroGenerado
    End Function

End Class
